home *** CD-ROM | disk | FTP | other *** search
- Path: lrz-muenchen.de!sun2!ua302aa
- From: ua302aa@sun2.lrz-muenchen.de (Kurt Watzka)
- Newsgroups: comp.lang.c
- Subject: Re: Newbie Q: Arrays > 64K?
- Date: 4 Feb 1996 22:51:59 GMT
- Organization: Leibniz-Rechenzentrum, Muenchen (Germany)
- Distribution: world
- Message-ID: <4f3daf$46g@sparcserver.lrz-muenchen.de>
- References: <4f3ajc$oud@earth.superlink.net>
- NNTP-Posting-Host: sun2.lrz-muenchen.de
-
- rizzom@superlink.net writes:
-
- >Hi,
-
- > I am using Turbo C++ 3.0 in DOS. I would just like to know
- >how to declare an array that is larger than 64K. I have tried
- >all of the memory models available and still get an error
-
- You cannot portably have object with sizes greater than 32k in
- C. So obviously, your compiler does not have a problem when it
- gives you an error message for arrays larger than 64k.
-
- You could
-
- 1) Modify your data structure so that no object is larger than
- 32k (The size of one "VMProc" should be less than 2k on
- most machines, so an array of pointers to VMProc should
- be possible on most machines, working somehow like this:)
-
- VMProc *proc[64];
-
- for (i = 0; i < 64; i+= 16) {
- VMProc *tmp = calloc(16, sizeof(VMProc));
- if (tmp == NULL)
- /* Handle error condition */
- for (j = 0; j < 16, j++)
- proc[i + j] = tmp + j;
- }
-
- You have to check my assumption about the size of a VMProc
- on your machine, using your implementation.
-
- 2) Consider using an operating system that allows you to
- use larger objects and forget about portability.
-
- Kurt
- --
- | Kurt Watzka Phone : +49-89-2180-6254
- | watzka@stat.uni-muenchen.de
- | ua302aa@sunmail.lrz-muenchen.de
-
-